<%@page contentType="text/html;charset=UTF-8"%>
<%@include file="/common/commonTag.jsp"%>

<html>
	<head>
		<title>修改密码</title>
		<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
		<link rel="stylesheet" href="${path}/css/backsys/ctx.css">
		<script type="text/javascript" src="${path}/js/jquery.js"></script>
		<script type="text/javascript">
			function modifyPwd() {
				
				var beforpwd = $("#beforpwd") ;
				var password = $("#password") ;
				var passwordagain = $("#passwordagain") ;
				$.post("${path}/validateJson!modifyChkPwd.action?valResult="+beforpwd.val()+"&d="+new Date().getTime(),null,function(data){
					var d = eval("("+data+")") ;
					if(d.valResult != "true") {
						alert("原密码不正确！");
						return ;
					} 
					if(password.val() != passwordagain.val()) {
						alert("新密码与确认密码不相同！");
						return ;
					} else {
						if(password.val() != "" && passwordagain.val() != "") {
							var dataParam = {"ea.password":password.val(),"ea.id":"${employee.id}","d":new Date().getTime()};
							$.post("${path}/privilegeEmpJson!modifyPwd.action",dataParam,function(data){
								var d = eval("("+data+")") ;
								if(d.exist == true) {
									alert("修改密码成功，系统退出，请重新登录");
									window.parent.location.href="../exitSystem!exitSystem.action" ;
								} else {
									alert("修改密码失败");
								}
							});
							
						} else {
							alert("新密码和确认密码不能为空！");
						}
					}
				});
				
			}
		</script>
	</head>

	<body>
		<div class="ctx">
			<table class="ow" width="100%">
				<tr>
					<th height="30" colspan="2" align="left">修改密码</th>
				</tr>
				<tr>
					<td align=right width=40%>原密码：</td>
					<td><input type="text" name="beforpwd" size="30" id="beforpwd"/></td>
				</tr>
				<tr>
					<td align=right>新密码：</td>
					<td><input type="text" name="password" size="30" id="password"/></td>
				</tr>
				<tr>
					<td align=right>确认密码：</td>
					<td><input type="text" name="passwordagain" size="30" id="passwordagain"/></td>
				</tr>
				<tr>
					<td class="td3" colspan="2" align="center">
						<input type="button" class="btobg" value="修改密码" onclick="modifyPwd();"/>
					</td>
				</tr>
			</table>
		</div>
	</body>
</html>
